/*
 * @Author: your name
 * @Date: 2021-09-21 11:54:01
 * @LastEditTime: 2021-09-21 12:59:26
 * @LastEditors: Please set LastEditors
 * @Description: 实现一个栈的功能
 * @FilePath: \数据结构\栈\stack.h
 */
#ifndef _STACK_H_
#define _STACK_H_

//空栈指示
#define EMPTY_POS -1

//栈数据类型
typedef int elementType;

//栈结构
typedef struct stack
{
    //栈容量 0~capacity-1
    int capacity;
    //栈顶
    int stackTop;
    //指针
    elementType * array;
}STACK;

//判断栈空
bool isEmpty(STACK *s);
//判断栈满
bool isFull(STACK *s);
//创建栈
STACK* createStack(int stackSize);
//释放栈
void freeStack(STACK *s);
//pop
elementType pop(STACK *s);
//push
bool push(STACK *s, elementType ele);
//获取栈顶元素
elementType top(STACK *s);
//清空栈
bool clearStack(STACK *s);

#endif